﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="System.Collections.Generic" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    监控分析报告列表
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%
        List<int> years = (List<int>)ViewData["years"];
        int year = (int)ViewData["year"];
        IEnumerable<AnalysisReporting> reportings = (IEnumerable<AnalysisReporting>)ViewData["reportings"];
    %>

    <div style="margin-bottom:10px;">
      <form method="get" action="">
      选择年份：
      <select name="year" onchange="submit();">
      <%foreach (int y in years){%>
          <option value="<%=y %>" <%if (y == year) { %>selected="selected"<%} %>><%=y %>年</option>
      <%} %>
      </select>
      </form>
    </div>
    
    <table cellpadding="4" cellspacing="0" class="com_from_table">
        <tr>
            <th style="width:60px;">报告时间</th>
            <th>公司</th>
            <th>堆场\尾矿库</th>
            <th>报告状态</th>
            <th>&nbsp;</th>
        </tr>
        <%foreach (AnalysisReporting r in reportings)
          { %>
        <tr>
            <td class="lab" style="text-align:center;"><%=r.date.Year + "-" + r.date.Month %></td>
            <td style="padding-left:0.8em;"><%=r.FactoryName %></td>
            <td style="padding-left:0.8em;"><%=r.StackName %></td>
            <td><%=r.status == 0 ? "未分配" : (r.status == 1 ? "未完成" : (r.status == 2 || r.status == 3 ? "已完成" : ""))%><%if (r.status == 1){ %> (<a href="/Reporting/Input/<%=r.id %>">填写</a>)<%}else if (r.status == 2 || r.status == 3){ %>(<a href="/Reporting/View/<%=r.id %>">查看</a>)<%} %></td>
            <td><%=r.status == 3 ? "已发布" : (r.status == 2 ? "未发布" :  "")%></td>
        </tr>
        <%} %>  
    </table>
</asp:Content>
